< previous page page_459 next page >

Page 459
e10a6a0a59f035e870d90cca05b85fce.gif
    ' Project.
    If ptype = m3Perspective And d2 <> 0 Then
         m3PerspectiveXZ M5, d2
    Else
         m3Identity M5
    End If

    ' Combine the transformations.
    m3MatMultiply M12, M1, M2
    m3MatMultiply M34, M3, M4
    m3MatMultiply M1234, M12, M34
     If ptype = m3Perspective Then
         m3MatMultiplyFull M, M1234, M5
    Else
         m3MatMultiply M, M1234, M5
    End If
End Sub
Spherical Coordinates
In normal, Cartesian coordinates, you specify a point using X, Y, and Z coordinates. Other coordinate systems are also possible, and sometimes they are more convenient.
In spherical coordinates, a point is specified by three parameters: R, f, and q. R is the distance from the point to the origin. f is the angle between the line from the origin to the point and the X-Z plane. q is the angle the vertical plane containing the point and the Y axis makes with the X axis. Figure 13.35 shows the spherical representation of a point. Using Figure 13.35 and a little trigonometry, you can see that:
e10a6a0a59f035e870d90cca05b85fce.gif
y = R * Sin(f)
x = R * Cos(
f) * Cos(q)
z = R * Cos(
f) * Sin(q)
Sometimes it is more convenient to specify a center of projection in spherical coordinates instead of the usual Cartesian coordinates. If the focus point is at the origin, you
z0479-02.gif
Figure 13.35
Spherical coordinates.

 
< previous page page_459 next page >